package com.ruoyi.merchant.service;

import com.ruoyi.merchant.domain.MessageSession;
import com.ruoyi.merchant.domain.MessageStatistics;
import com.ruoyi.merchant.domain.NotificationSettings;

import java.util.List;
import java.util.Map;

/**
 * 消息服务接口
 */
public interface IMessageService {

    /**
     * 获取消息统计数据
     */
    MessageStatistics getMessageStatistics(Long merchantId);

    /**
     * 获取消息会话列表
     */
    List<MessageSession> getMessageSessions(Long merchantId, String msgType, Integer pageNum, Integer pageSize);

    /**
     * 获取会话聊天记录
     */
    List<Map<String, Object>> getChatHistory(Long sessionId, Long merchantId, Integer pageNum, Integer pageSize);

    /**
     * 发送消息
     */
    int sendMessage(Long sessionId, Long merchantId, Long customerId, String content, String messageType);

    /**
     * 发送优惠券
     */
    int sendCoupon(Long sessionId, Long merchantId, Long customerId, Long couponTemplateId, String customMessage);

    /**
     * 标记消息已读
     */
    int markMessagesAsRead(Long sessionId, Long merchantId, List<Long> messageIds);

    /**
     * 获取可用优惠券列表
     */
    List<Map<String, Object>> getAvailableCoupons(Long merchantId);

    /**
     * 删除消息会话
     */
    int deleteMessageSession(Long sessionId, Long merchantId);

    /**
     * 获取消息通知设置
     */
    NotificationSettings getNotificationSettings(Long merchantId);

    /**
     * 更新消息通知设置
     */
    int updateNotificationSettings(Long merchantId, NotificationSettings settings);

    /**
     * 发送消息（带附件）
     */
    int sendMessage(Long sessionId, Long merchantId, Long customerId, String content,
                    String messageType, Map<String, Object> attachments);

    /**
     * 根据会话ID获取用户最新订单详情
     */
    Map<String, Object> getLatestOrderBySessionId(Long sessionId, Long merchantId);
}